/*
 * Copyright 1999-2018 Alibaba Group Holding Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.alibaba.nacos.core.distributed.distro.component;

import com.alibaba.nacos.core.distributed.distro.entity.DistroData;

/**
 * Distro数据处理器，用于处理Distro协议的数据对象.
 *
 * @author xiweng.yy
 */
public interface DistroDataProcessor {
    
    /**
     * 当前处理器可处理的类型.
     *
     * @return 处理器类型
     */
    String processType();
    
    /**
     * 处理接收的数据.
     *
     * @param distroData 接收的数据
     * @return 处理数据成功返回true，否则返回false
     */
    boolean processData(DistroData distroData);
    
    /**
     * 处理接收的验证数据.
     *
     * @param distroData    验证数据
     * @param sourceAddress 源服务器地址
     * @return 数据有效返回true，否则返回false
     */
    boolean processVerifyData(DistroData distroData, String sourceAddress);
    
    /**
     * 处理快照数据.
     *
     * @param distroData 快照数据
     * @return 处理数据成功返回true，否则返回false
     */
    boolean processSnapshot(DistroData distroData);
}
